<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    const arr = [
        {id: 1, lng: '100', lat: '105'},
        {id: 2, lng: '101', lat: '1051'},
        {id: 3, lng: '102', lat: '1052'},
        {id: 4, lng: '1003', lat: '1053'},
        {id: 5, lng: '104', lat: '1054'},
    ]

    let k = []
    arr.forEach(item => {
        k.push(item.lng, item.lat)
    })

    console.log(k)
    console.log(k.join(','))
    console.log("===================")

    let s1 = "2"
    let s2 = undefined
    let s3 = "2,1"

    function just(str) {

        if (str) {
            let result = []
            if (str.includes(',')) {
                result = str.split(',')
            } else {
                result.push(str)
            }
            console.log(result)
        }else {
            console.log('no:', str)
        }


    }

    just(s1)
    just(s2)
    just(s3)
</script>
</body>
</html>
